<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ include file="/WEB-INF/views/public/main.jsp"%>
<ul>
	<li><a href="#">State</a></li>
</ul>
<div id="stateModule" class="tab_padding">
<script type="text/javascript" src="${resourceUrl}/js/module_state.js"></script>
	<h3>Manage States</h3>
	<c:choose>
		<c:when test="${stateList.size() > 0}">
			<table id="stateModule_table" class="bordertable">
				<tr>
					<th>States</th>
					<th>Delete</th>
				</tr>
				<% boolean rowToggle = false; %>
				<c:forEach var="state" items="${stateList}">
					<tr>
						<td>${state.getName()}</td>
						<td> <a class="stateModuleDeleteState" href="${rootUrl}secure/admin/state/delete/$${state.getId()}">Delete</a></td>
					</tr>
				</c:forEach>
			</table>

		</c:when>
		<c:otherwise>
			<p>No State added so far. Click ADD to add new State</p>
		</c:otherwise>
	</c:choose>
	<br/>
	<div id="stateModule_add_dialog" class="dialog" title="Add new State">
		<form:form method="POST" id="stateModule_add_form" action="${rootUrl}secure/admin/state/add" commandName="state" class="noEnterSubmit">
			<fieldset class="ui-helper-reset">
			 <table >
	  		  <tr>
	  		  	<td class="label"><label id="lname" for="name">State Name</label></td>
	  		  	<td><form:input path="name" id="name" size="25" class="required" minlength="3" ></form:input></td>
	  		  </tr>
	  		  </table>
			</fieldset>
		</form:form>
		<label id="stateModule_add_dialog_status"></label>
	</div>	
	<div id="stateModule_delete_dialog" class="dialog" title="Delete State">
			 <p>
			 Do you really want to delete the state of '<span id="stateModule_delete_message"></span>' ?
			 </p>			
		<label id="stateModule_delete_dialog_status"></label>
	</div>
	<button id="stateModule_add_button" class="customButton">Add State</button>			
</div>